Python lambda function if else condition